package aop04;

import aop03.SomeException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Test {
    public static void main(String[] args) {
        ApplicationContext ac = new ClassPathXmlApplicationContext("aop04/spring.xml");
        UserService userService = (UserService) ac.getBean("userService");
        EmpService empService = (EmpService) ac.getBean("empService");
        TeacherService teacherService = (TeacherService) ac.getBean("teacherService");
        userService.login();
        System.out.println("********************************");
        try {
            userService.regist();
        } catch (SomeException e) {
        }

        System.out.println("*********************************");

        userService.add(3,5);

        System.out.println("*********************************");
        userService.doEveryOne("茅台");
        System.out.println("*********************************");
        userService.doOther();
        System.out.println("*********************************");
        userService.doSome();
        System.out.println("*********************************");


        empService.getAll();
        System.out.println("*********************************");

        empService.regist();
        System.out.println("*********************************");

        empService.doSome();
        System.out.println("*********************************");
        empService.doOther("五粮液");

        System.out.println("*********************************");
        teacherService.regist();
        System.out.println("*********************************");
        teacherService.doSome();
        System.out.println("*********************************");
        teacherService.doOther("二锅头");

    }

}
